1 using UnityEngine;
2 using
System.Collections;
3
4 public
class Thruster : MonoBehaviour {
5
6     
public bool on;
7     
public float power;
8
9
10     
void Update () {
11
12         
if (Input.GetButton("Jump")) {
13
14             Debug.Log (
"what the fuck?");
15             
on = true;
16         
17         }
else {
18             
on = false;
19         }
20
21         
if (Input.GetAxis ("Horizontal") != null) {
22             
float direction = Input.GetAxis ("Horizontal");
23             transform.Rotate (direction,
0,0);
24         }
25
26         
if (on) {
27             transform.GetComponent<Rigidbody> ().AddForce (transform.up * power);
28
29         }
30     }
31 }


Gõ tìm kiếm nhanh...